import { createRouter, createWebHashHistory } from 'vue-router'
import nprogres from 'nprogress'
import 'nprogress/nprogress.css'

import funTestRoutes from './modules/funTest'

const routes = [
  {
    path: '/',
    name: 'home',
    component: () => import('../views/home/index.vue')
  },
  funTestRoutes
]

const router = createRouter({
  history: createWebHashHistory(), // 路由模式
  routes
})

router.beforeEach((to) => {
  nprogres.start()
  if (to.meta.title) {
    document.title = to.meta.title
  }
})

router.afterEach(() => {
  nprogres.done()
})
export default router
